#include <stdio.h>
#include <math.h>

double fact(int n){ //计算阶乘的函数
	if (n==0){
		return 1;
	}
	else{
		double f=1,i;
		for(i=1;i<=n;i++){
			f*=i;
		}
		return f;
	}
}
int main(){

    double error;
    double approx=0,accur;
    int i=0,n;
    double x;

    scanf("%lf",&x);
    error = pow(10,-4);
    accur = cos(x); 

    while(fabs(approx-accur)>error){
        approx += (pow(-1,i)*pow(x,2*i))/fact(2*i);
        i++;
    }
    n = i-1; //因为最后一次循环i多加了一次，所以这里要减1
    printf("%d",n);
    // printf("approx: %lf,accur: %lf\n",approx,accur); //查看两个值之间的差异
    return 0;
}